package com.esjob.task;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import org.springframework.stereotype.Component;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/19  8:49
 * 描述:
 */

@Component
public class MyTask1 implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {
        //当前的分片编号
        int shardingItem = shardingContext.getShardingItem();

        if(shardingItem==0){

            System.out.println("==============>分片1执行");

        }else if(shardingItem==1){

            System.out.println("==============>分片2执行");

        }

    }
}
